const request = require('../utils/request')

/**
 * 获取订单预览数据
 * 
 * @returns {Promise<unknown>}
 */
export const orderPreview = () => request.get('/api/orders/preview')

/**
 * 提交订单
 * 
 * @returns {Promise<unknown>}
 */
export const addOrder = (data) => request.post('/api/orders', data)

/**
 * 订单详情
 * 
 * @returns {Promise<unknown>}
 */
export const getOrderInfo = (id) => request.get('/api/orders/' + id + '?include=orderDetails.goods,address')

/**
 * 订单列表
 * 
 * @returns {Promise<unknown>}
 */
export const getOrderList = (data) => request.get('/api/orders', data, false)